//
//  SISSNavigationController.m
//  SISSAPP
//
//  Created by 优房网 on 2017/3/10.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSNavigationController.h"

#import "ImageWithColor.h"


@interface SISSNavigationController ()

@end

@implementation SISSNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:COLOR(0x334A60)}];
    
    [[UINavigationBar appearance] setTintColor:COLOR(0xB0C0D6)];
    
    [[UINavigationBar appearance] setBackgroundImage:[ImageWithColor imageWithColor:[UIColor colorWithWhite:1 alpha:0.99]] forBarMetrics:UIBarMetricsDefault];


    [UINavigationBar appearance].backIndicatorImage = [UIImage imageNamed:@"back"];
    [UINavigationBar appearance].backIndicatorTransitionMaskImage = [UIImage imageNamed:@"back"];
    
}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    viewController.hidesBottomBarWhenPushed = self.viewControllers.count > 0;

    viewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
    
//    if (self.viewControllers.count != 0) {
//        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStyleDone target:self action:@selector(back)];
//    }
    
    [super pushViewController:viewController animated:animated];
    
}


//- (void)back {
//    
//    [self popViewControllerAnimated:YES];
//}

- (instancetype)init {
    if (self = [super init]) {
        self.supportLandscape = NO;
    }
    return self;
}

- (UIInterfaceOrientationMask) navigationControllerSupportedInterfaceOrientations:(UINavigationController *) navigationController{
    if(self.supportLandscape){
        return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeRight;
    }else{
        return UIInterfaceOrientationMaskPortrait;
    }
}


@end
